package cn.highset.modules.base.serviceimpl;

import cn.highset.modules.base.dao.ExhibitorCollectDao;
import cn.highset.modules.base.entity.ExhibitorCollect;
import cn.highset.modules.base.service.ExhibitorCollectService;
import cn.hutool.core.collection.CollUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 展商收藏接口实现
 *
 * @author Victor
 */
@Slf4j
@Service
@Transactional
public class ExhibitorCollectServiceImpl implements ExhibitorCollectService {

    @Autowired
    private ExhibitorCollectDao exhibitorCollectDao;

    @Override
    public ExhibitorCollectDao getRepository() {
        return exhibitorCollectDao;
    }


    @Override
    public ExhibitorCollect findByExhibitorIdAndUserid(String exhibitorId, String userid) {
        List<ExhibitorCollect> list = exhibitorCollectDao.findByExhibitorIdAndUserid(exhibitorId, userid);
        return CollUtil.isNotEmpty(list) ? list.get(0) : null;
    }
}
